class route {
  constructor() {
    this.routes = {}
    this.currentpath = ''
    this.freshroute = this.freshroute.bind(this)
    window.addEventListener('load', this.freshroute, false)
    window.addEventListener('hashchange', this.freshroute, false)
  }
  store(path, fn) {
    this.routes[path] = fn || function () { }
  }
  freshroute() {
    this.currentpath = location.hash.slice(1) || '/'
    this.routes[this.currentpath]()
  }
}